package phone.example.com.a36kr.activity.findactivity;

import android.util.Log;
import android.widget.ListView;

import phone.example.com.a36kr.R;
import phone.example.com.a36kr.adapter.newslistviewadapter.NewsAdapter;
import phone.example.com.a36kr.bean.NewsBean;
import phone.example.com.a36kr.bean.UrlBean;
import phone.example.com.a36kr.nettool.NetTool;
import phone.example.com.a36kr.tools.BaseActivity;

/**
 * Created by dllo on 16/9/6.
 */
public class FindRecentGraduateActivity extends BaseActivity{


    private NewsAdapter adapter;
    private ListView lv;

    @Override
    protected int setLayout() {
        return R.layout.activity_graduate_recent_find;
    }

    @Override
    protected void initView() {
        lv = bindView(R.id.find_graduate_lv);


    }

    @Override
    protected void initData() {

        initNet();
    }

    private void initNet() {
        NetTool netTool = new NetTool();
        netTool.getNetData(UrlBean.NEWS_STUDY_URL, NewsBean.class, new NetTool.NetListener<NewsBean>() {
            @Override
            public void onSuccess(NewsBean newsBean) {
                adapter = new NewsAdapter(FindRecentGraduateActivity.this);
                Log.d("FindRecentGraduateActiv", "newsBean:" + newsBean);
                adapter.setNewsBean(newsBean);
                Log.d("FindRecentGraduateActiv", "adapter:" + adapter);
                lv.setAdapter(adapter);
            }

            @Override
            public void onError(String errorMsg) {

            }
        });
    }
}
